package com.abel.bigwater.dataserver.model.qdies

import com.abel.bigwater.data.BcdString
import io.netty.buffer.Unpooled
import org.junit.Assert.assertEquals
import org.junit.Test
import org.slf4j.LoggerFactory

class MainAskTimeDataTest {

    @Test
    fun testFill() {
        val buf = Unpooled.buffer()
        val p = MainPacket().apply {
            address = BcdString(byteArrayOf(12, 0, 0, 1), true)
            func = FuncType.AskTime
            data = MainAskTimeData()

            fill(buf)
        }

        val str = BcdString.create(buf, buf.readableBytes()).bcdString
        lgr.info(str)
        assertEquals(DEMO_SET_TIME, str)
    }

    companion object {
        private val lgr = LoggerFactory.getLogger(MainAskTimeDataTest::class.java)

        const val DEMO_SET_TIME = "681200000102008316"
    }
}